
public class Q1 {

    class Node {
        int val;
        Node next;

        public Node(int val, Node next) {
            this.val = val;
            this.next = next;
        }
    }

    public Node removeNthFromNode(Node node, int n) {
        Node tail = node;
        for (int i = 0; i < n; i++) {
            tail = tail.next;
        }
        if (tail == null) {
            //
            return node.next;
        }
        Node delete = node;
        Node pre = delete;
        while (tail != null) {
            tail = tail.next;
            pre = delete;
            delete = delete.next;
        }

        pre.next = delete.next;
        // 存在如果delete是头的情况
        return node;

    }

    public int[] eq(int[] nums,int target) {
        //
        return null;
    }

}
